package com.project.redis.controller;

import com.project.redis.service.RedisService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 缓存控制器
 * @author mengxj
 */
@RestController
@RequestMapping("redis")
public class RedisController {

    @Resource
    private RedisService redisService;

    @PostMapping("set")
    public void set(@RequestParam("key") String key, @RequestParam("value") String value){
        this.redisService.set(key, value);
    }

    @GetMapping("get")
    public Object get(@RequestParam("key") String key){
        return this.redisService.get(key);
    }
}
